package br.edu.unifei.tfg.algorithms.fm;

import br.edu.unifei.mestrado.commons.graph.NodeWrapper;

/**
 * Simple "almost-POJO" (=P) class to represent the pair (Node, Gain) used in the
 * Fiduccia-Mattheyses analysis.
 * 
 * @author Bruno Toffolo
 *
 */
public class Gain implements Comparable<Gain> {
	
	/** ID of the node. */
	private NodeWrapper node;
	
	/** Gain of the node. */
	private int gain;
	
	public Gain(NodeWrapper node, int gain) {
		this.node = node;
		this.gain = gain;
	}
	
	@Override
	public int compareTo(Gain o) {
		return o.gain - this.gain;
	}

	/**
	 * @return the nodeID
	 */
	public NodeWrapper getNode() {
		return node;
	}

	/**
	 * @param nodeID the nodeID to set
	 */
	public void setNode(NodeWrapper node) {
		this.node = node;
	}

	/**
	 * @return the gain
	 */
	public int getGain() {
		return gain;
	}

	/**
	 * @param gain the gain to set
	 */
	public void setGain(int gain) {
		this.gain = gain;
	}

}